﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using MyBlog.DataAccessInterface;
using MyBlog.DataEntity;

namespace MyBlog.DataAccess
{
    public class AlbumContext: IDALAlbum
    {
        IContext _context;
        public AlbumContext(IContext context)
        {
            _context = context;
        }
        public void Add(Tbl_Album entity)
        {
            _context.Add(entity);
        }

        public void Update(Tbl_Album entity)
        {
            _context.Update(entity);
        }

        public void Delete(params object[] primaryKey)
        {
            _context.Delete<Tbl_Album>(primaryKey);
        }

        public void AddRange(IEnumerable<Tbl_Album> entities)
        {
            _context.AddRange(entities);
        }

        public void DeleteRange(IEnumerable<Tbl_Album> entities)
        {
            _context.DeleteRange(entities);
        }

        public void Delete(System.Linq.Expressions.Expression<Func<Tbl_Album, bool>> keySelector)
        {
            _context.Delete(keySelector);
        }

        public Tbl_Album Get(System.Linq.Expressions.Expression<Func<Tbl_Album, bool>> keySelector)
        {
            return _context.Get(keySelector);
        }

        public Tbl_Album Get(params object[] primaryKey)
        {
            return _context.Get<Tbl_Album>(primaryKey);
        }

        public List<Tbl_Album> GetAll(bool isTracking = true)
        {
            return _context.GetAll<Tbl_Album>(isTracking);
        }

        public List<Tbl_Album> GetAll(System.Linq.Expressions.Expression<Func<Tbl_Album, bool>> keySelector, bool isTracking = true)
        {
            return _context.GetAll<Tbl_Album>(keySelector, isTracking);
        }

        public List<Tbl_Album> GetAll(System.Linq.Expressions.Expression<Func<Tbl_Album, bool>> keySelector, int page, int size, out int total, bool isTracking = true)
        {
            return _context.GetAll<Tbl_Album>(keySelector, page, size, out total, isTracking);
        }
    }

}
